# generate quarter variables based on monthly data
# Input: wfcount_mon.csv/wellscount_mon.csv/emp_mon.csv

BEGIN {
  FS = ","
  OFS = ","
  print "county", "year", "month", "qtr",
  # "windfarm", "cap"             
  # "wells", "gas", "oil", "others"
  "emp"
}

{

  if (NR == 1)
    next
  # z = split($2,time,"-")
  # year = time[1]
  # month = time[2]
  month = $3
  if (month ~ /0[123]/) { qtr = "Qtr1" }
  if (month ~ /0[456]/) { qtr = "Qtr2" }
  if (month ~ /0[789]/) { qtr = "Qtr3" }
  if (month ~ /1[012]/) { qtr = "Qtr4" }
  print $1, $2, $3, qtr, $4 #, $5, $6, $7
  # print $1, year, month, qtr, $3, $4

}



